#!/bin/python
from requests import get as requests_get
from bs4 import BeautifulSoup


### CONSTANTS
PATH = "https://anime-bit.ru"
SKIP_WORDS = (
    "Ongoing",
    "Full",
    "Film",
)


### FUNCTIONS
def request_site(path = PATH):
    '''Check exist page or not. If not return `False`
    If exist return html_doc
    path - path to site
    '''
    html_doc = requests_get(path)
    if html_doc.status_code != 200:
        return False
    return html_doc.text

def get_strings_tag(html_doc, tag):
    '''Get strings from tags
    '''
    soup = BeautifulSoup(html_doc, "html.parser")
    strings = []
    for tag in soup.find_all(tag):
        string = tag.string
        if string in SKIP_WORDS:
            continue
        strings.append(tag.string)
    return strings


if __name__ == '__main__':
    html_doc = request_site()
    [print(name) for name in get_strings_tag(html_doc, 'h2')]
